﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ww.wwf.wwfbll;
using ww.lis.lisbll.sam;
using System.Collections;
using System.IO;

namespace ww.form.lis.sam.jy
{
    public partial class CheckUserForm : ww.form.wwf.SysBaseForm
    {
        public string fchenk_user_Tag = "";
        public string fchenk_user_Text = "";

        LoginBLL bll = new LoginBLL();

        public CheckUserForm()
        {
            InitializeComponent();
        }

        private void buttonTC_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button保存_Click(object sender, EventArgs e)
        {
            if (this.SysLoginUserName.Text == "" || SysLoginUserName.Text == null || SysLoginUserName.Text.Length == 0)
            {
                ww.wwf.wwfbll.WWMessage.MessageShowWarning("用户名不能为空！");
                this.ActiveControl = SysLoginUserName;
                return;
            }
            string userid = this.SysLoginUserName.Text;
            string pwd = this.SysLoginPassword.Text;

            if (this.bll.BllUserPassOk(userid, pwd))
            {
                DataTable dtorg = this.bll.BllUserOrg(userid);
                fchenk_user_Tag = dtorg.Rows[0]["fperson_id"].ToString();
                fchenk_user_Text = dtorg.Rows[0]["fname"].ToString();
            }
            else
            {
                ww.wwf.wwfbll.WWMessage.MessageShowWarning("用户名或密码有误！请重新输入");
                return;
            }

            this.DialogResult = DialogResult.OK;
        }

        private void SysLoginUserName_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                this.ActiveControl = SysLoginPassword;
        }

        private void SysLoginPassword_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                this.ActiveControl = button保存;
        }
    }
}